import Vue from 'vue'
import VueRouter from 'vue-router'
import Main from '../views/Main.vue'
import Home from '../views/Home.vue'
import User from '../views/User.vue'
//1.定义路由
//2.创建路由与组件的对应关系
//3.创建router实例，然后传routes配置
//4.在main.js中挂载router，在App组件中展示
//嵌套路由的使用

Vue.use(VueRouter);
const routes = [{
    path: '/',
    component: Main,
    children: [{
        path: 'home',
        component: Home
    }, {
        path: 'user',
        component: User
    }]
}]


const router = new VueRouter({
    routes
})


export default router